package com.helei.springcloud.controller;

import com.helei.springcloud.entity.Payment;
import com.helei.springcloud.entity.Resp;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author helei
 * @description Ordcontroller
 * @date 2020/7/15 11:48
 */
@RestController
public class OrdController {
    public static final String URL = "http://cloud-payment-service";

    @Resource
    RestTemplate restTemplate;

    @GetMapping(value = "consumer/aa")
    public Resp create(Payment payment) {
       return restTemplate.postForObject(URL+"/provider/aa",payment,Resp.class);
    }
    @GetMapping(value = "consumer/bbb")
    public Resp find(Integer id) {
        return restTemplate.getForObject(URL+"/provider/bbb?id="+id,Resp.class);
    }

}
